package com.fnn.mapper;

import com.fnn.entity.Record;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;

public interface RecordMapper {
    //还书后，插入借阅记录到record表里
    @Insert("insert into record(book_id, record_book_name, record_book_isbn, user_id, record_borrower, record_borrow_time, record_remand_time) values(book_id=#{book_id},record_book_name=#{record_book_name},record_book_isbn=#{record_book_isbn},user_id=#{user_id},record_borrower=#{record_borrower},record_borrow_time=#{record_borrow_time},record_remand_time=#{record_remand_time})")
    //把book实体与book数据表中的字段映射起来
    @Results(id="recordEntity", value = {
            @Result(column = "record_id",property = "record_id"),
            @Result(column = "book_id",property = "book_id"),
            @Result(column = "record_book_name",property = "record_book_name"),
            @Result(column = "record_book_isbn",property = "record_book_isbn"),
            @Result(column = "user_id",property = "user_id"),
            @Result(column = "record_borrower",property = "record_borrower"),
            @Result(column = "record_borrow_time",property = "record_borrow_time"),
            @Result(column = "record_remand_time",property = "record_remand_time"),
    })
    void insertRecord(Record record);


}
